"""用户模型"""
from datetime import datetime
from typing import Optional
from pydantic import BaseModel


class UserBase(BaseModel):    # 与数据库对应的响应模型
    us_id: int
    username: str
    name: str
    sex: int
    photo: str
    phone: str
    zhuanye: Optional[str]
    ruxue: Optional[str]
    intro: Optional[str]
    created_at: datetime
    updated_at: datetime


class UserCreate(UserBase):
    username: str
    password: str
    name: str
    sex: int
    photo: str
    phone: str
    zhuanye: Optional[str]
    ruxue: Optional[str]
    intro: Optional[str]


class UserRead(UserBase):
    pass


class UserUpdate(UserBase):
    password: Optional[str]
    photo: Optional[str]
    phone: Optional[str]
    zhuanye: Optional[str]
    intro: Optional[str]


class UserDelete(UserBase):
    pass

    class Config:
        orm_mode = True